package com.tarena.day020;

public class BinDemo {
  public static void main(String[] args) {
    //int 是32位补码
    int num = -1;
    System.out.println(Integer.toBinaryString(num)); 
    
    System.out.println(Integer.toBinaryString(-10)); 
    System.out.println(Integer.toBinaryString(-9)); 
    System.out.println(Integer.toBinaryString(-8)); 
    System.out.println(Integer.toBinaryString(-7)); 
    System.out.println(Integer.toBinaryString(7)); 
       //...
    //byte 类型是8位补码
    byte b = (byte)(127+1);//补码的副作用
    System.out.println(b);//-128
    
    System.out.println(Integer.toBinaryString(135)); 
    
    //-135
    
    int max = 0x7fffffff;//二进制的简写
    System.out.println(max);//java默认按照人的习惯输出数字
    int min = max+1;//0x80000000
    System.out.println(min);
    System.out.println(Integer.toBinaryString(min));
    System.out.println(Integer.toHexString(min)); 
    System.out.println(Integer.toBinaryString(-135)); 
    System.out.println(Integer.toHexString(-135)); 
     
    
    
  }
}






